<template>
	<view theme="aaaa">
		<view class="title">
			我的{{addNum}}
		</view>

		<view class="name">
			kjksdjlfdsl
		</view>

		<x-home ref="homePageRef" name="测试"></x-home>
	</view>
</template>

<script setup>
	import {
		ref,
		onMounted
	} from 'vue'
	import {
		onLoad
	} from "@dcloudio/uni-app"
	import {
		useAdd,
		useFetch
	} from './hook';

	const num1 = ref(2)
	const num2 = ref(1)
	//加法功能-自定义Hook（将响应式变量或者方法形式暴露出来）
	const {
		addNum,
		addFn
	} = useAdd({
		num1,
		num2
	})
	addFn(num1.value, num2.value)

	const url = ref('/initial-url')

	const {
		data,
		error
	} = useFetch(url)
	url.value = '/new-url'

	console.log(data.value, error);


	import {
		useTheme
	} from "@/hook/theme.js"
	const {
		themeName,
		getTheme,
		changeTheme
	} = useTheme()
	changeTheme("主题1")
	console.log(themeName.value)

	const homePageRef = ref()


	import http from "@/common/api/index.js"

	import {
		getList
	} from "./service.js"

	onMounted(() => {
		// homePageRef.value.pageShow()

		// getList().then(res=>{
		// 	console.log(res);
		// })
		
		// http.getDataList().then(res=>{
		// 	console.log(res);
		// })
	})
</script>

<style lang="scss">
	.title {
		color: var(--color-red);
	}

	.name {
		// color: $uni-color-primary;
		color: $bpy-active-color;
		font-size: var(--default-size);
	}
</style>